package com.wfm.leetcode.editor.cn;
public class POne1盛最多水的容器{
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    // 两个指针指向两端，更短的向内移动，最后统计最大面积
    // O(N) O(1)
    public int maxArea(int[] height) {
        int i = 0;
        int j = height.length-1;
        int ans = 0;
        while (i<j){
            int i1 = Math.min(height[i], height[j]) * (j - i);
            ans=Math.max(i1,ans);
            if(height[i]<height[j]) i++;
            else j--;
        }
        return ans;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

    public static void main(String[] args) { 
        Solution solution = new POne1盛最多水的容器().new Solution();
    }
}